<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:sijyp="http://java.sun.com/jsf/composite/sijyp"
	template="#{bienManager.vincularHechoMode ? '/templates/simpleTemplate.xhtml' : '/templates/template.xhtml'}">
	<ui:define name="body">
		<rich:panel style="width:100%">
			
			<f:facet name="header">
				#{msg['configuracion.parametrizacion']}
			</f:facet>

			<h:form id="frm_config_param">

				<h:panelGroup layout="block" id="frm_config_param_block">
					#{msg['configuracion.parametrizacion.titulo_tabla']}
					<hr width="100%" />
					<br />
				</h:panelGroup>

				<br />

				<rich:dataTable id="dt_parametros" keepSaved="true" 
					var="record"
					noDataLabel="${msg['general.registrosNoEncontrados']}"
					value="#{consultarParametrosConfig.paramConfigAppConsulta.dataModel}" 
					rows="10">

					<ui:include src="/resources/sijyp/dataModels/column.xhtml">
						<ui:param name="render_sort" value="dt_parametros" />
						<ui:param name="key" value="parametro" />
						<ui:param name="header"
							value="#{msg['configuracion.parametrizacion.nombreparametro']}" />
						<ui:param name="column" value="1" />
						<ui:param name="managedBean"
							value="#{consultarParametrosConfig.paramConfigAppConsulta}" />
					</ui:include>

					<ui:include src="/resources/sijyp/dataModels/column.xhtml">
						<ui:param name="render_sort" value="dt_parametros" />
						<ui:param name="key" value="descripcion" />
						<ui:param name="header"
							value="#{msg['configuracion.parametrizacion.parametrodescripcion']}" />
						<ui:param name="column" value="2" />
						<ui:param name="managedBean"
							value="#{consultarParametrosConfig.paramConfigAppConsulta}" />
					</ui:include>

					<ui:include src="/resources/sijyp/dataModels/column.xhtml">
						<ui:param name="render_sort" value="dt_parametros" />
						<ui:param name="key" value="tipodato" />
						<ui:param name="header"
							value="#{msg['configuracion.parametrizacion.tipodato']}" />
						<ui:param name="column" value="3" />
						<ui:param name="managedBean"
							value="#{consultarParametrosConfig.paramConfigAppConsulta}" />
					</ui:include>

					<ui:include src="/resources/sijyp/dataModels/column.xhtml">
						<ui:param name="render_sort" value="dt_parametros" />
						<ui:param name="key" value="valor" />
						<ui:param name="header" value="#{msg['configuracion.parametrizacion.valor']}" />
						<ui:param name="column" value="4" />
						<ui:param name="managedBean"
							value="#{consultarParametrosConfig.paramConfigAppConsulta}" />
					</ui:include>

					<rich:column>
						<f:facet name="header">
							<h:outputLabel
								value="${msg['configuracion.parametrizacion.tabla_acciones']}" />
						</f:facet>
						<h:commandLink value="" action="#{consultarParametrosConfig.editarParametro()}">
							<f:setPropertyActionListener
								target="#{consultarParametrosConfig.casoSeleccionado}" value="#{record[0]}" />
							<h:graphicImage value="/resources/images/icons/ico_pencil.png"
								title="${msg['configuracion.parametrizacion.editar']}" />
						</h:commandLink>

						<h:commandLink value="" 
							action="#{consultarParametrosConfig.setIdParamEliminar(record[0])}"
							onclick="#{rich:component('confirmDelete')}.show()">
							<h:graphicImage value="/resources/images/icons/ico_delete.png"
								title="${msg['configuracion.parametrizacion.eliminar']}" />
							<f:ajax execute="@this" render=":dt_parametros" />	
						</h:commandLink>
					</rich:column>

					<f:facet name="footer">
						<rich:dataScroller id="scroller" />
					</f:facet>
				</rich:dataTable>

				<h:panelGroup style="text-align:center;" layout="block">
					<h:commandButton value="#{msg['configuracion.parametrizacion.nuevo_registro']}"
						action="#{consultarParametrosConfig.crear}">
					</h:commandButton>
				</h:panelGroup>

				<sijyp:confirmDialog message="${msg['configuracion.parametrizacion.confirmaBorrar']}"
					confirmId="confirmDelete"
					renderComponents=":frm_config_param :dt_parametros confirmDelete"
					acceptAction="#{consultarParametrosConfig.eliminarParametro}">
				</sijyp:confirmDialog>

			</h:form>
		</rich:panel>
	</ui:define>
</ui:composition>
